local yidu = fk.CreateSkill{
    name = "jin_heg__yidu",
}

Fk:loadTranslationTable{
    ["jin_heg__yidu"] = "遗毒",
    [":jin_heg__yidu"] = "当你使用伤害类牌后，你可展示一名未受到过此牌伤害的目标角色的至多两张手牌，然后若这些牌颜色均相同，弃置之。",
    ["#jin_heg__yidu-invoke"] = "遗毒：选择一名未受到过此牌伤害的目标角色，展示其至多两张手牌，若颜色相同则全部弃置",

    ["$jin_heg__yidu1"] = "彼之砒霜，吾之蜜糖。",
    ["$jin_heg__yidu2"] = "巧动心思，以遗他人。", 
}

yidu:addEffect(fk.CardUseFinished,{
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(yidu.name) and data.card.is_damage_card
      end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local targets = table.filter(data:getAllTargets(), function(id) return
          (not data.damageDealt or (data.damageDealt and not data.damageDealt[id])) and not id:isKongcheng() end)
        if #targets == 0 then return end
        local to = room:askToChoosePlayers(player,{
            targets = targets,
            min_num = 1,
            max_num = 1,
            prompt = "#jin_heg__yidu-invoke",
            skill_name = yidu.name,
            cancelable = true,
        })
        if #to > 0 then
          event:setCostData(self, {tos = to})
          return true
        end
      end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self).tos[1]
        local cards = room:askToChooseCards(player,{
            target = to,
            min = 1,
            max = math.min(2, #to:getCardIds("h")),
            flag = "h",
            skill_name = yidu.name,
        })
        to:showCards(cards)
        for _, id in ipairs(cards) do
          if Fk:getCardById(id).color ~= Fk:getCardById(cards[1]).color then
            return
          end
        end
        room:throwCard(cards, yidu.name, to, player)
      end,
})

return yidu